package com.gxa.jd.controller.front;

import com.gxa.entity.PageResult;
import com.gxa.entity.Result;
import com.gxa.jd.pojo.UserShipping;
import com.gxa.jd.service.UserShippingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/front/userShipping")
public class UserShippingFrontController {

    @Autowired
    private UserShippingService userShippingService;


    //根据用户id查询收货地址列表TODO

    @GetMapping("/findById")
    public UserShipping findById(Long id) {
        return userShippingService.findById(id);
    }


    @PostMapping("/add")
    public Result add(@RequestBody UserShipping userShipping) {
        //用户id从当前线程获取
        userShippingService.add(userShipping);
        return new Result();
    }

    @PostMapping("/update")
    public Result update(@RequestBody UserShipping userShipping) {
        //用户id从当前线程获取
        userShippingService.update(userShipping);
        return new Result();
    }


}
